package com.beerbear.consumer.config.listener;

import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

import java.util.Map;

/**
 * @Author: Beer Bear
 * @Description: todo
 * @Date: 2021/9/2 16:30
 */
@Component
public class SpringRabbitMQListener {

    @RabbitListener(queues = "queue1")
    // 参数必须和发消息的一致
    public void rabbitRabbitMQListener(String msg){
        System.out.println("接收消息:"+msg);
    }

    @RabbitListener(queues = "object.queue1")
    public void rabbitListenerForObjectQueue(Map<String,String> msg){
        System.out.println("接收对象消息:"+msg);
    }
}
